const { ccclass, property } = cc._decorator;

enum CITY {
    LIJIANG,
    PHUKET,
    HANGZHOU,
    CHENGDU,
    GUANGZHOU,
    SINGAPORE,
    HONGKONG,
    HULUNBEIER,
    TOKYO,
    BANGKOK,
    CHONGQING,
    XIAMEN
}

const cityNames = ["丽江", "普吉岛", "杭州", "成都", "广州", "新加坡", "香港", "呼伦贝尔", "东京", "曼谷", "重庆", "厦门"];

@ccclass
export default class HotRecommendCtrl extends cc.Component {
    @property(cc.Node)
    content: cc.Node = null;

    @property(cc.Prefab)
    cityIconItem: cc.Prefab = null;

    start() {
        this.createCityList();
    }

    createCityList() {
        if (this.content.childrenCount === 0) {
            for (let i = 0; i < cityNames.length; i++) {
                const city = cc.instantiate(this.cityIconItem);
                city.getComponent("CityIconItemCtrl").initData({
                    name: cityNames[i],
                    index: i
                });
                this.content.addChild(city);
            }
        }
    }
}
